<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Naming Conventions</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Smarty 3 Manual">
<link rel="up" href="plugins.html" title="Chapter 18. Extending Smarty With Plugins">
<link rel="prev" href="plugins.html" title="Chapter 18. Extending Smarty With Plugins">
<link rel="next" href="plugins.writing.html" title="Writing Plugins">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Naming Conventions</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="plugins.html">Prev</a> </td>
<th width="60%" align="center">Chapter 18. Extending Smarty With Plugins</th>
<td width="20%" align="right"> <a accesskey="n" href="plugins.writing.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="sect1" title="Naming Conventions">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="plugins.naming.conventions"></a>Naming Conventions</h2></div></div></div>
<p>
     Plugin files and functions must follow a very specific naming
     convention in order to be located by Smarty.
    </p>
<p>
     <span class="bold"><strong>plugin files</strong></span> must be named as follows:
     </p>
<div class="blockquote"><blockquote class="blockquote"><p>
       <code class="filename">
        <em class="replaceable"><code>type</code></em>.<em class="replaceable"><code>name</code></em>.php
       </code>
      </p></blockquote></div>
<p>
    </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem">
<p>
     Where <code class="literal">type</code> is one of these plugin types:
     </p>
<div class="itemizedlist"><ul class="itemizedlist" type="circle" compact>
<li class="listitem">function</li>
<li class="listitem">modifier</li>
<li class="listitem">block</li>
<li class="listitem">compiler</li>
<li class="listitem">prefilter</li>
<li class="listitem">postfilter</li>
<li class="listitem">outputfilter</li>
<li class="listitem">resource</li>
<li class="listitem">insert</li>
</ul></div>
<p>
    </p>
</li>
<li class="listitem"><p>
     And <code class="literal">name</code> should be a valid identifier; letters,
     numbers, and underscores only, see
     <a class="ulink" href="http://php.net/language.variables" target="_top">php variables</a>.
    </p></li>
<li class="listitem"><p>
     Some examples: <code class="filename">function.html_select_date.php</code>,
     <code class="filename">resource.db.php</code>,
     <code class="filename">modifier.spacify.php</code>.
    </p></li>
</ul></div>
<p>
     <span class="bold"><strong>plugin functions</strong></span> inside the PHP files must be named as follows:
     </p>
<div class="blockquote"><blockquote class="blockquote"><p>
       <code class="function">smarty_<em class="replaceable"><code>type</code></em>, _<em class="replaceable"><code>name</code></em></code>
      </p></blockquote></div>
<p>
    </p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
     The meanings of <code class="literal">type</code> and <code class="literal">name</code> are
     the same as above.
    </p></li>
<li class="listitem"><p>
     An example modifier name <code class="varname">foo</code> would be <code class="literal">function smarty_modifier_foo()</code>.
    </p></li>
</ul></div>
<p>
     Smarty will output appropriate error messages if the plugin file it
     needs is not found, or if the file or the plugin function are named
     improperly.
    </p>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="plugins.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="plugins.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="plugins.writing.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Chapter 18. Extending Smarty With Plugins </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> Writing Plugins</td>
</tr>
</table>
</div>
</body>
</html>
